<template>
	<uni-popup type="bottom" ref="devTypePopupRef">
		<uni-list>
			<uni-list-item :title="row.name" clickable :show-arrow="true" @click="()=>{}" v-for="row in listDevType"></uni-list-item>
			<uni-list-item title="添加设备" clickable :show-arrow="true" @click="()=>{}"></uni-list-item>
		</uni-list>
	</uni-popup>
</template>

<script setup>
	import { onBeforeMount,ref } from 'vue'
	import {dbHelper,deviceTypeTable} from '@/dataAccess/index.js'
	const devTypePopupRef=ref(null)
	const listDevType=ref([]);
	const show = ()=>{
		devTypePopupRef.value.open();
	};
	
	const close=()=>{
		devTypePopupRef.value.close();
	};
	
	onBeforeMount(()=>{
		dbHelper.open().then(()=>{
			dbHelper.selectTableData(deviceTypeTable.tableName,'').then(rows=>{
				console.log('rows',rows);
				listDevType.value=rows;
			}).catch(ex=>{
				console.error(ex);
			});
		});
	});
	
	defineExpose({ show,close })
</script>

<style>
</style>